from conduit.Base import ConduitBase, InitConduitBase
import json


class RedisConduit(ConduitBase):
    "管道类"

    def process(self, data: bytes):
        daj = json.load(data.decode("utf-8"))    # 拿到类型

        if daj["data_type"] == "int":  # 断言
            data = int(daj["database"])
        elif daj["data_type"] == "str":
            data = daj["database"]
        elif daj["data_type"] == "float":
            data = float(daj["database"])

        sends = self.conduit(data)


class InitConduit(InitConduitBase):
    "开始管道"
    data_type = None

    def process(self, data: bytes):
        da = self.conduit()
